$(function () {
    var accountId = window.localStorage.getItem("accountId")

    let url = '/account/findAccountById';
    var params = {
        accountId: accountId
    }
    $.get(url, params, returnData)

    function returnData(resp) {
        if (resp.status === 200) {
            var account = resp.data;

            $('#accountId').val(account.accountId)
            $('#realName').val(account.realName)
            $('#idcardNo').val(account.idcardNo)
            $('#loginName').val(account.loginName)
            $('#telephone').val(account.telephone)
            $('#birthdate').val(account.birthdate)
            $('#email').val(account.email)
            $('#mailAddress').val(account.mailaddress)
            $('#zipcode').val(account.zipcode)
            $('#qq').val(account.qq)

            var occupation = account.occupation;
            switch (occupation) {
                case '干部':
                    $('#c').attr('selected', 'selected')
                    break;
                case '学生':
                    $('#s').attr('selected', 'selected')
                    break;
                case '技术人员':
                    $('#te').attr('selected', 'selected')
                    break;
                default:
                    $('#el').attr('selected', 'selected')
                    break;
            }


            if (account.gender == '男') {
                $('#male').attr('checked', 'checked')
            } else {
                $('#female').attr('checked', 'checked')
            }

            var recommenderId = account.recommenderId;
            var param = {
                accountId: recommenderId
            }
            $.get(url, param, recommender)
        }
    }

    function recommender(resp) {
        if (resp.status === 200) {
            $('#referrerCard').val(resp.data.idcardNo)
        }
    }
})